<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Tintuc extends MY_Controller {

    public function __construct() {
        parent:: __construct();
    }
    public function index()
    {
    }
    
    public function construct_news($id)
    {
         /*compare*/
         $data['compare']='';
        if(isset($this->session->userdata['items'])&&$this->session->userdata['items']!='')
        {
        $strproduct_id = $this->session->userdata['items'];
        if($strproduct_id!='')
        {
        $this->load->model('sanpham');
            $arrProducts= explode(',',$strproduct_id);
            foreach($arrProducts as $product){
                $product_db['id'] = $product;
                $product_db['name'] = $this->sanpham->get_product_name($product);
                $data['temp'][$product]=$product;
                $data['compare'].='<li class="com'.$product_db['id'].'"><a href="javascript:void(0)" onclick="deleteCompare('.$product_db['id'].')">'.$product_db['name'].'</a></li>';
            }
        }
         }
         else{
             $data['compare']='<li class="null_comp">Vui lòng chọn sản phẩm để so sánh</li>';
        }
            //$this->template->write_view('compare','test/content',$data);
        //$data['compare']=$this->parser->parse('compare/main',$product_db,true);
            /*compare*/
        $data['header'] =  $this->parser->parse('main/header','',true);
        $data['footer'] =  $this->parser->parse('main/footer','',true);
        $data['menu'] =  $this->parser->parse('main/menu','',true);
        
        
        
        
        return $this->parser->parse('tintuc/index',$data,false);
    }
    
    
    public function header()
    {
        
        
    }
   
}